// 创建一个百分比对象
export class Percent {
  protected _value: number;
  constructor(percent: number) {
    this._value = percent;
  }
  public get value(): number {
    return this._value / 100;
  }
  public get percent(): number {
    return this._value;
  }
  public toString(): string {
    return "" + this._value + "%";
  }
}

// Percent 的 构造函数
export function percent(value: number): Percent {
  return new Percent(value);
}

export function isPercent(value: any): boolean {
  return value instanceof Percent;
}
